<nav class="pbHeader">
	<ul>
		<li class="active"><a href="./index.html">首页</a></li>
		<li><a href="./plats.html">平台商</a></li>
		<li><a href="./industry.html">行业雷达</a></li>
		<li><a href="./market.html">市场雷达</a></li>
		<li><a href="./activity.html">行业活动</a></li>
		<li><a href="./square.html">雷达广场</a></li>
		<div class="loginType">
			<div class="login">
				<a href="./login.html">登录</a>
				<a href="./reg.html">注册</a>
			</div>
			<div class="logined" style="display: none;">
				<span class="login-name" id="userName">姿态丶</span>
				<span class="glyphicon glyphicon-menu-down"></span>
				<div href="#" class="con">
					<li><a href="javaScript:;" id="vipCenter">会员中心</a></li>
					<li><a href="javaScript:;" id="">个人信息</a></li>
					<li><a href="javaScript:;" id="quit">退出</a></li>
				</div>
			</div>
		</div>
	</ul>
</nav>
<header class="hidden-xs">
        <div class="container">
            <div class="logo"><a href="index.html"><img src="img/logo.png" alt=""></a><span class="page-class"></span></div>
            <div class="search pull-right">
                <div class="input-group">
                    <input type="text" class="form-control" id="sInput" placeholder="Search for..">
                    <span class="input-group-btn">
                        <button class="btn btn-primary" type="button" id="searchAll">搜索</button>
                    </span>
                </div>
                <span class="tit">热门分类：<span id="hotTag"></span></span>
            </div>
        </div>
	</header>
	
<style>
	*{margin: 0;padding: 0}
	nav{background-color: #4698f9;height: 50px;}
	.pbHeader > ul{width: 1183px;margin: 0 auto;}
	.pbHeader ul >li{list-style: none;float: left;line-height: 50px;margin-right: 20px;}
	.pbHeader a{text-decoration: none;color: #fff;font-size: 16px}
	.pbHeader .loginType{float: right;}
	.pbHeader .loginType a{line-height: 30px;}
	.pbHeader .loginType .login a{line-height: 50px;}
	.pbHeader .active a{color: #f3ce21}
	.pbHeader .loginType{position: relative;}
	.pbHeader .loginType .logined{position: absolute;top: 1.2em;width: 100px;color: #fff;cursor:pointer}
	.pbHeader .loginType .logined .con a{color: #fff;font-size: 14px;}
	.pbHeader .loginType .logined .con{background: #555;position: absolute;border-radius: 4px;display: none;z-index: 16;padding: 6px 10px;}
	.pbHeader .loginType .logined:hover .con{display: block;}
	.pbHeader .loginType .logined:hover .con li{line-height: 26px;}
</style>
<script>
if (localStorage.token != null){
	$(".loginType .login").css("display",'none')
	$(".loginType .logined").css("display",'block')
}
// 热门标签
Getdata(getValueByName, {name: "hotDynamicTags"}).then(res =>{
	let data = res.data.value.split("-");
	let itema='';
	$.each(data,function(index,item){
		itema += `<a href="../search.html?keywords=${item}">${item}</a> `
	})
	$("#hotTag").html(itema)
})


function getPathname(){
    // 获取当前页面
	var winPath = window.location.pathname;
	console.log(winPath)
    switch(winPath){
        case "/plats.html":
			$("ul li").eq(1).addClass("active").siblings().removeClass("active");
            break;
        case "/hot-plat.html":
            $("ul li").eq(1).addClass("active").siblings().removeClass("active");
			break;
		case "/search.html":
            $("ul li").eq(1).addClass("active").siblings().removeClass("active");
			break;
		case "/platDetail.html":
            $("ul li").eq(1).addClass("active").siblings().removeClass("active");
			break;
		case "/industry.html":
            $("ul li").eq(2).addClass("active").siblings().removeClass("active");
			break;
		case "/detail.html":
            $("ul li").eq(2).addClass("active").siblings().removeClass("active");
			break;
		case "/market.html":
            $("ul li").eq(3).addClass("active").siblings().removeClass("active");
			break;
		case "/activity.html":
            $("ul li").eq(4).addClass("active").siblings().removeClass("active");
			break;
		case "/square.html":
            $("ul li").eq(5).addClass("active").siblings().removeClass("active");
			break;
		case "/pushc.html":
            $("ul li").eq(5).addClass("active").siblings().removeClass("active");
			break;
		case "/business-vip.html":
            $("ul li").eq(5).addClass("active").siblings().removeClass("active");
            break;
    }
}
getPathname();
$("#searchAll").click(function(){
	let sousuo = $("#sInput").val();
	if (sousuo == "") { alert("请输入信息"); return false; }
	location.href = "../search.html?keywords=" + sousuo;
})

$('#sInput').bind('keypress', function (event) { 
   if (event.keyCode == "13") { 
    $("#searchAll").click();
   }
})
let keyVal =  GetQueryString('keywords');
keyVal = decodeURI(keyVal)
$('#sInput').val(keyVal)
// console.log(userInfo)
$("#userName").html(userInfo.name)
// 退出登录
function quite() {
    Getdata(logout, `POST`).then(res => {
        console.log(res);
    })
    window.localStorage.removeItem('token');
    window.localStorage.removeItem('user');
    window.location.reload();
}
// 退出
$("#quit").click(function () {
    quite();
})
$(".con li:lt(2)").click(function(){
	if(userType0() == "1"){
        window.location.href = "user-vip.html";
	}else if(userType0() == "2"){
		window.location.href = "business-vip.html";
	}
})

</script>